
import 'package:flutterlib/common/config/config.dart';
import 'package:flutterlib/model/activity/activity_create_request.dart';
import 'package:flutterlib/model/activity/activity_detail_bean.dart';
import 'package:flutterlib/model/activity/activity_join_request.dart';
import 'package:flutterlib/model/activity/activity_page_new_query.dart';
import 'package:flutterlib/model/activity/activity_page_query.dart';
import 'package:flutterlib/model/activity/activity.dart';
import 'package:flutterlib/model/activity/activity_page.dart';
import 'package:flutterlib/model/post/comment_bean.dart';
import 'package:flutterlib/model/post/comment_bean_tree.dart';
import 'package:flutterlib/model/post/comment_request.dart';
import 'package:retrofit/retrofit.dart';
import 'package:dio/dio.dart' hide Headers;

import '../api.dart';

part 'activity_api.g.dart';

@RestApi()
abstract class ActivityApi {
  factory ActivityApi(Dio dio, {String baseUrl}) = _ActivityApi;

  factory ActivityApi.builder()=> ActivityApi(HttpManager().getDio());


  //按照用户加入的小群来筛选活动
  @POST("/activity/pageByNewQuery")
  Future<ActivityPage> pageByNewQuery(@Body() ActivityPageQuery pageQuery);

  @POST("/activity/pageByQuery")
  Future<ActivityPage> pageByQuery(@Body() ActivityPageQuery pageQuery);



  @GET("/activity/getDetailById")
  Future<ActivityDetailBean> getActivity(@Query("id") int id);

  @GET("/activity/getActivitys")
  Future<List<Activity>> getActivitys(@Query("user_id") int userId);

  @GET("/activity/getApplyActivitys")
  Future<List<Activity>> getApplyActivitys(@Query("user_id") int userId);

  @GET("/activity/testBool")
  Future<bool> testBool();

  @GET("/tags")
  Stream<List<String>> getTagsAsStream();

  @POST("/activity/test")
  Future<String> testReturn(@Body() Activity activity);

  @POST("/activity/create")
  Future<ActivityDetailBean> create(@Body() ActivityCreateRequest dto);

  @POST("/activity/joinActivity")
  Future<bool> joinActivity(@Body() ActivityJoinRequest dto);

  @POST("/activity/likeActivity")
  Future<void> like(@Query("id") int id);

  @POST("/activity/unLikeActivity")
  Future<void> unLike(@Path("id") int id);
  //
  // @GET("/post/open/{postId}/activityComments/tree_view")
  // Future<CommentBeanTree> activityCommentPageByQuery(@Path("postId") int postId,
  //     @Query("page") int page,
  //     @Query("order") String order
  //     );
  //
  // @POST("/post/open/activityComments")
  // Future<CommentBean> activityComments(@Body() CommentRequest request);

  @GET("/activity/viewActivity")
  Future<bool> viewActivity(@Query("id") int id);

  //获取全部活动,按时间排序
  @POST("/activity/getAllActivitys")
  Future<ActivityPage> getAllActivity(@Body() ActivityPageNewQuery pageQuery);
  @GET("/activity/updateStatus")
  Future<bool> updateStatus(@Query("activityId") int activityId, @Query("status") int status);
}


